<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Models\Relations\CompanyInfoTrait;
use App\Models\Relations\JobsTrait;
use App\Models\Relations\UserInfoTrait;

/**
 *
 * @author Joker
 * id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	company_id int(11) NOT NULL DEFAULT 0 COMMENT '公司编号，为0 为系统考试',
	job_id int(11) NOT NULL DEFAULT 0 COMMENT '职位编号，为0 为系统考试',
	exam_name VARCHAR(255) NOT NULL DEFAULT '试卷名称',
	examination_id int(11) NOT NULL COMMENT '试卷编号',
	user_id int(11) NOT NULL COMMENT '用户编号',
	questions text NOT NULL COMMENT '序列化字段，所有问题的集合',
	answer_question text NOT NULL COMMENT '序列化，用户回答的集合',
	score_list text NOT NULL COMMENT '序列化，每道题 获得分数集合',
	ehtime TINYINT(2) NOT NULL DEFAULT 0 COMMENT '考试用时',
	score SMALLINT(4) NOT NULL DEFAULT 0 COMMENT '最后分值',
	created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
	updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,        
 */
class ExaminationHistory extends Model
{
    use CompanyInfoTrait,JobsTrait,UserInfoTrait;
    
    protected $table='examination_history';
    
    protected $fillable = ['id','company_id','job_id','exam_name','examination_id','user_id','questions','answer_question',
        'score_list','ehtime','score','app'
    ];
    
    public function exam()
    {
        return $this->hasOne('App\Models\Examination','id','examination_id');
    }
}